package com.visikard.ui.fragment;

import java.util.HashMap;

import android.os.Bundle;
import android.support.v4.app.Fragment;

public class RetainedFragment extends Fragment {
	
	private HashMap<String, Object> mSavedObjectMap;
	
	public RetainedFragment(){
		mSavedObjectMap = new HashMap<String, Object>();
	}

	@Override
	public void onCreate(Bundle savedInstanceState) {
		super.onCreate(savedInstanceState);
		
		setRetainInstance(true);
		
		if(savedInstanceState == null){
			mSavedObjectMap = new HashMap<String, Object>();
		}
	}
	
	public void putObject(String key, Object savedObj){
		mSavedObjectMap.put(key, savedObj);
	}
	
	public Object getObject(String key){
		return mSavedObjectMap.get(key);
	}

}
